package corelayer;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */
public class Node implements INode {

    private IDevice device;
    private ArrayList<IPacket> sendQueue;
    private ArrayList<INode> recentlyCrossed;
    private ArrayList<IMessage> ownMessages;
    
    
    public Node(IDevice dev) {
        this.device = dev;
        this.sendQueue = new ArrayList<IPacket>();
        this.recentlyCrossed = new ArrayList<INode>();
        this.ownMessages = new ArrayList<IMessage>();
    }

    @Override
    public String getID() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<IPacket> getSendQueue() {
        return this.sendQueue;
    }

    @Override
    public List<INode> getRecentlyCrossed() {
        return this.recentlyCrossed;
    }

    @Override
    public List<IMessage> getOwnMessages() {
        return this.ownMessages;
    }

    @Override
    public void broadcast(IPacket packet) {
        this.device.send(packet);
    }

    @Override
    public void pushUserMessage(IMessage msg) {
        this.ownMessages.add(msg);
    }
}
